<template>
    <div class="switch__self">
        <input :id="`switch-${id}`" type="checkbox" />
        <label :for="`switch-${id}`"></label>
    </div>
</template>
<script>
import { toRefs } from 'vue';
export default {
    props: {
        id: {
            type: String || Number,
            default: 'usb',
        },
    },
    setup(props, context) {
        const { id } = toRefs(props);
        return { id };
    },
};
</script>
<style lang="less">
/*  SWITCH  */
.switch__self {
    input {
        display: none;
    }
}

.switch__self {
    width: 6rem;
}

.switch__self label {
    display: flex;
    align-items: center;
    width: 100%;
    height: 3rem;
    box-shadow: 0.3rem 0.3rem 0.6rem #c8d0e7, -0.2rem -0.2rem 0.5rem #ffffff;
    background: rgba(255, 255, 255, 0);
    position: relative;
    cursor: pointer;
    border-radius: 1.6rem;
}

.switch__self label::after {
    content: '';
    position: absolute;
    left: 0.4rem;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 50%;
    background: #9baacf;
    transition: all 0.4s ease;
}

.switch__self label::before {
    content: '';
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(330deg, #238067 0%, #2ebb96 50%, #8abdff 100%);
    opacity: 0;
    transition: all 0.4s ease;
}

.switch__self input:checked ~ label::before {
    opacity: 1;
}

.switch__self input:checked ~ label::after {
    left: 57%;
    background: #e4ebf5;
}
</style>
